package model;
import lejos.nxt.*;
import lejos.robotics.proposal.DifferentialPilot;
import lejos.util.*;

public class Nhoek
{
    DifferentialPilot pilot ;
    
    public void  drawSquare(float length, int n)
    {
    	if(n < 3){
    		System.out.println("n moet > 2");
    		return;
    	}
        for(int i = 0; i<n ; i++)
        {
            pilot.travel(length);
            pilot.rotate(360/n);                 
        }
    }
    
    public static void main(String[] args)
    {
        Nhoek sq = new Nhoek();
        Motor.B.setSpeed(360);
        Motor.C.setSpeed(360);
        ButtonCounter bc = new ButtonCounter();
        bc.count("links = n, rechts = afstand*10");
        int n = bc.getLeftCount();        
        float length = (float) (bc.getRightCount()*10*0.393700787);   
        
        sq.pilot = new DifferentialPilot(2.20472441f, 4.33070866f, Motor.B, Motor.C);
        sq.drawSquare(length, n);
        
    }
}
